package org.springds3.d1.test1;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component ("userAction")
public class UserAction {
//    @Autowired//可以加在属性，set方法，构造方法上
//    @Qualifier("userService2")



    @Resource//默认按名字一样的注入
    private  UserService userService;

//    public UserService getUserService() {
//        return userService;
//    }



//@Autowired
//    public void setUserService(@Qualifier("userService2") UserService userService) {
//        this.userService = userService;
//    }


//    public UserAction(){}
//    @Autowired(required = false)//不是必须注入
//    public UserAction(@Qualifier("userService2")UserService userService){
//
//        this.userService=userService;
//    }

    public void index(){
        userService.getUserName(20);
    }






}
